package com.kaoshi.management.controller;

import com.kaoshi.common.config.Result;
import com.kaoshi.management.service.FileUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@CrossOrigin
@RequestMapping
public class FileUploadController {

    @Autowired
    FileUploadService fileUploadService;

    @RequestMapping("/upload")
    public Result upload(MultipartFile file) {
        String path = fileUploadService.uploadFile(file);
        return Result.ok(path);
    }
}
